﻿@{
    ViewBag.Title = "BllInProfitStc";
}
@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/shared/shown.js?ver=GetDate()")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
    <form id="form1" runat="server" method="post" style="height: 100%">

        @Html.Partial("~/Views/Modular/ReportsToolbar.cshtml")

        <div id="DivHeader">
            <table style="margin-bottom:4px;">
                <tr>
                    <td width="70px" align="right">单据日期：</td>
                    <td width="240px">
                        @Html.Partial("~/Views/Modular/dxDateRange.cshtml")
                    </td>
                    <td width ="70px" align="right">方案编号：</td>
                    <td width ="150px">
                        <input name="FBillNo" class="mini-textbox" style="width:150px;"/>
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td width="70px" align="right">门店名称：</td>
                    <td width="190px">
                        @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")
                    </td>
                    <td width="70px" align="right">商品分类：</td>
                    <td width="200px">
                        @Html.Partial("~/Views/Modular/LookupGoodsClass.cshtml")
                    </td>
                </tr>
                <tr>
                    <td width="70px" align="right">商品名称：</td>
                    <td width="200px">
                        @Html.Partial("~/Views/Modular/LookupGoodInfo.cshtml")
                    </td>
                    <td width="70px" align="right">商品品牌：</td>
                    <td width="200px">
                        @Html.Partial("~/Views/Modular/LookupGoodsBrand.cshtml")
                    </td>
                </tr>
            </table>
        </div>
        <div class="mini-fit">
            <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;" pageSize="15"
                 url="../Report/GetBillDetail"
                 allowCellSelect="true" allowCellEdit="true" showSummaryRow="false"  fitColumns="false" sortMode="client">
                <div property="columns">
                    <div type="checkcolumn"></div>
                    <div field="FBillNo" width="110" headerAlign="center">方案编号</div>
                    <div field="FCode" width="100" headerAlign="center">商品条码</div>
                    <div field="FName" width="130" headerAlign="center">商品名称</div>
                    <div field="FSpec" width="80" headerAlign="center">规格型号</div>
                    <div field="FUnitName" width="40" headerAlign="center">单位</div>
                    <div field="mFQty_St" name="mFQty_St" width="90" headerAlign="center" align="right" numberFormat="#,0.00">结存数量</div>
                    <div field="mFPrice" name="mFPrice" width="80" headerAlign="center" align="right" numberFormat="#,0.00">单价</div>
                    <div field="mFAmount" name="mFAmount" width="100" headerAlign="center" align="right" numberFormat="#,0.00">结存金额</div>
                    <div field="mFQty" name="mFQty" width="100" headerAlign="center" align="right" numberFormat="#,0.00">盘点数量</div>
                    <div field="mFProfitQty" name="mFProfitQty" width="100" headerAlign="center" align="right" numberFormat="#,0.00">盘盈数量</div>
                    <div field="mFProfitAmt" name="mFProfitAmt" width="100" headerAlign="center" align="right" numberFormat="#,0.00">盘盈金额</div>
                    <div field="mFLostQty" name="mFLostQty" width="100" headerAlign="center" align="right" numberFormat="#,0.00">盘亏数量</div>
                    <div field="mFLostAmt" name="mFLostAmt" width="100" headerAlign="center" align="right" numberFormat="#,0.00">盘亏金额</div>
                    <div field="FNumber" width="90" headerAlign="center">商品编码</div>
                    <div field="FClassNumber" width="80" headerAlign="center">分类编码</div>
                    <div field="FClassName" width="120" headerAlign="center">>分类名称</div>
                    <div field="FStockName" width="100" headerAlign="center">门店名称</div>
                    <div field="FUserName" width="80" headerAlign="center">用户名称</div>
                </div>
            </div>
        </div>

        <script type="text/javascript">

        var dDiff = [{ "id": "0", "text": "全部" },
                 { "id": "1", "text": "小于零 <0" },
                 { "id": "2", "text": "等于零 =0" },
                 { "id": "3", "text": "大于零 >0" }];

        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();
        var hdatatype = getQueryString("datatype");
        var sumFields = "";

        function FormShown() {
            var nowDate = new Date();
            mini.getbyName("FDate1").setValue(nowDate);
            mini.getbyName("FDate2").setValue(nowDate);
            LoadData();
            InitGrid('BllDetailStc');
        }

        function clearloca() {
            mini.getbyName("FStockID").setValue("");
            mini.getbyName("FStockID").setText("");
            mini.getbyName("FStockName").setValue("");
            mini.getbyName("FClassNumber").setValue("");
            mini.getbyName("FClassNumber").setText("");
            mini.getbyName("FGoodsClassName").setValue("");
        }

        function LoadData() {
            var cDate1 = mini.getbyName("FDate1").getFormValue();
            var cDate2 = mini.getbyName("FDate2").getFormValue();
            var mStockID = mini.getbyName("FStockID").getValue();
            var mGoodsID = mini.getbyName("FGoodItemID").getValue();
            var mClassID = mini.getbyName("FClassNumber").getValue();
            var mBrandID = mini.getbyName("FBrandItemID").getValue();
            var mBillNo = mini.getbyName("FBillNo").getValue();

            var json = "[{";
            json = json + '"mListType":' + '"' + hdatatype + '",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mDate1":' + '"' + cDate1 + '",';
            json = json + '"mDate2":' + '"' + cDate2 + '",';
            json = json + '"mStockID":' + '"' + mStockID + '",';
            json = json + '"mGoodsID":' + '"' + mGoodsID + '",';
            json = json + '"mClassID":' + '"' + mClassID + '",';
            json = json + '"mBillNo":' + '"' + mBillNo + '",';
            json = json + '"mBrandID":' + '"' + mBrandID + '"';
            json = json + "}]";

            grid.load({ mydata: json });

            mExportDataUrl = grid.url;
            mExportDataJson = json;//导出
        }

        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [0];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "盘点盈亏表");
                }
            });
        }

        </script>

    </form>
</body>